package com.example.annotationdemo.stategy;

import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author kw
 * @program annotation-demo
 * @description
 * @create 2024 - 05 - 19 16:15
 **/
@Configuration
public class BusinessStrategyContext {

    @Autowired
    private Map<String, BusinessStrategy> maps;

    public void handleBusiness(ProceedingJoinPoint pjp, String type) {
        BusinessStrategy businessStrategy = maps.get(type);
        if (businessStrategy != null) {
            businessStrategy.execute(pjp);
        }
    }


}
